<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

        <title>用户管理</title>

        <link href="../../css/mine.css" type="text/css" rel="stylesheet" />
        <script type="text/javascript">
            //执行批量删除，设置鉴别字段method为delete
            function deleteByIds() {
                document.getElementById("method").value="delete";
                document.getElementById("form").submit();
            }
            //执行数据导出,设置鉴别字段method为export
            function exportData() {
                document.getElementById("method").value="export";
                document.getElementById("form").submit();
            }

            //全选/反选
            function selectedAll() {
                var allsel = document.getElementsByName("uid");/* uid为复选框的name属性值 */
                for ( var i = 0; i < allsel.length; i++) {
                    allsel[i].checked = !allsel[i].checked;
                }
            }
        </script>
    </head>
    <body>
        <style>
            .tr_color{background-color: #9F88FF}
        </style>
        <div class="div_head">
            <span>
                <span style="float: left;">当前位置是：系统管理-》用户管理</span>
                <span style="float: right; margin-right: 8px; font-weight: bold;">
                    <a style="text-decoration: none;" href="/user/add-ui">【添加】</a>
					<a href="javascript:void(0);" onclick="deleteByIds()">【删除】</a>
					<a href="javascript:void(0);" onclick="exportData()">【导出数据】</a>
                </span>
            </span>
        </div>
        <div></div>
        <div class="div_search">
            <span>
                <form  action="/user/getusers" method="post">
                     姓名：
					<input type="text"  name="username" value="${username}"/>
					 角色: 
					<input type="text"  name="pname" value="${pname}"/>
					 所属部门: 
					<input type="text"  name="bname" value="${bname}"/>
                    <input value="查询" type="submit" />
					
                </form>
            </span>
        </div>
        <div style="font-size: 13px; margin: 10px 5px;">
            <form id="form" action="/user/delete-checked" method="post">
            <table class="table_a" border="1" width="100%">
                <input type="hidden" name="method" id="method">
                <tbody>
						<tr style="font-weight: bold;">						
                        <td width="40px;">序号</td>
                        <td width="30px;">
                            全选<br/><input type="checkbox" onchange="selectedAll()"/></td>
						<td width="80px;">账号</td>
                        <td width="80px;">姓名</td>
                        <td >角色</td>
						<td width="100px;">所属部门</td>                                        
                        <td align="center" width="100px;">操作</td>
                    </tr>

                    <c:forEach items="${pageInfo.list}" var="user" varStatus="i">

                        <tr id="product1">
                            <td>${i.count}</td>
                            <td><input type="checkbox" name="uid" value="${user.id}"/></td>
                            <td>${user.account}</td>
                            <td><a href="view.jsp">${user.username}</a></td>
                            <td>${user.role.permname}</td>
                            <td>${user.dept.appartmentfullname}</td>
                            <td>
                                <a href="/user/update-ui?id=${user.id}">修改</a>
                                <a href="/user/delete-one?id=${user.id}">删除</a>
                            </td>
                        </tr>
                    </c:forEach>

					
                    <tr>
                        <td colspan="20" style="text-align: center;">						
                            <a style="text-decoration: none;" href=
                                    "/user/getusers?index=1
                                    &username=${username}&pname=${pname}&bname=${bname}">首页</a>
                            <a style="text-decoration: none;" href=
                                    "/user/getusers?index=${pageInfo.prePage==0?1:pageInfo.prePage}
                                    &username=${username}&pname=${pname}&bname=${bname}">上一页</a>

                            <c:forEach var="i" begin="1" end="${pageInfo.pages}">
                                <a style="text-decoration: none;" href="/user/getusers?
                                index=${i}&username=${username}&pname=${pname}&bname=${bname}">${i}</a>
                            </c:forEach>

                            <a style="text-decoration: none;" href=
                                    "/user/getusers?index=${pageInfo.nextPage==0?pageInfo.pages:pageInfo.nextPage}
                                    &username=${username}&pname=${pname}&bname=${bname}">下一页</a>

                            <a style="text-decoration: none;" href=
                                    "/user/getusers?index=${pageInfo.pages}
                                    &username=${username}&pname=${pname}&bname=${bname}">尾页</a>

                            共${pageInfo.total}条 当前页 ${pageInfo.pageNum}/${pageInfo.pages} </a>
                        </td>
                    </tr>
                </tbody>
            </table>
            </form>
        </div>
    </body>
</html>